package cn.kgm.user.dto.entity;

import cn.kgm.core.entity.Entity;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.time.LocalDateTime;

/**
 * # 技术改变自己 #
 * 用户登录日志表
 * @author kappi
 * @date   2024-04-08 13:28:48
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@TableName(value = "user_login_log", autoResultMap = true)
@ApiModel(value = "UserLoginLog", description = "用户登录日志表")
public class UserLoginLog extends Entity<Long>{

    /**
     * 用户账号ID:[user_account.id]
     */
    @ApiModelProperty(value = "用户账号ID:[user_account.id]")
    @TableField(value = "account_id")
    private Long accountId;

    /**
     * 请求参数
     */
    @ApiModelProperty(value = "请求参数")
    @TableField(value = "param", typeHandler = FastjsonTypeHandler.class)
    private JSON param;

    /**
     * 用户登录IP
     */
    @ApiModelProperty(value = "用户登录IP")
    @TableField(value = "ip_id")
    private Long ipId;

    /**
     * 失败次数
     */
    @ApiModelProperty(value = "失败次数")
    @TableField(value = "fail_num")
    private Boolean failNum;

    /**
     * log_id没失效前第一次失败时间
     */
    @ApiModelProperty(value = "log_id没失效前第一次失败时间")
    @TableField(value = "first_fail_time")
    private LocalDateTime firstFailTime;

    /**
     * log_id失效时间(登录时间+[user_pass_lock.fail_interval_time])
     */
    @ApiModelProperty(value = "log_id失效时间(登录时间+[user_pass_lock.fail_interval_time])")
    @TableField(value = "dead_time")
    private LocalDateTime deadTime;
}
